package com.pavelk.orion.view
{
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	import com.pavelk.orion.view.components.RegistrationView;
	
	public class RegistrationMediator extends BaseMediator implements IMediator
	{
		public static const NAME:String	= 'RegistrationMediator';
		
		private var registrationView:RegistrationView;
		
		public function RegistrationMediator( viewComponent:Object )// a co udelat viewComponent cely bg?
		{
			super( NAME, viewComponent );
			//trace( "view Component " + facade.retrieveMediator( StageMediator.NAME ).getViewComponent().background );
		}
		
		override public function onRegister():void
		{
			//registrationView = new RegistrationView( facade.retrieveMediator( StageMediator.NAME ).getViewComponent().background );
			registrationView = new RegistrationView();
			viewComponent.addChild( registrationView );
			sendNotification( ApplicationConstants.CMD_ASSETS, { river:"River" } );
		}
		
		override public function listNotificationInterests() : Array 
        {
            return [ 
						ApplicationConstants.RESULT_ASSETS,
						ApplicationConstants.PROGRESS_ASSETS                  	
                   ];
        }
        
        override public function handleNotification( note:INotification ) : void 
        {
            switch ( note.getName() ) 
            {
	             case ApplicationConstants.RESULT_ASSETS:
					registrationView.addAssets( note.getBody() );
	             	break;	
	             case ApplicationConstants.PROGRESS_ASSETS:

	                break;   	  		  	
            }
        }
	}
}